package com.syni.mdd.sjb.common.datatreaure.mapstruct;

import com.syni.mdd.sjb.common.datatreaure.entity.vo.rp.dataBankClient.ClientAllGroupRpVo;
import com.syni.mdd.sjb.common.datatreaure.entity.vo.rp.dataBankClient.ClientParamRpVo;
import com.syni.mdd.sjb.common.datatreaure.entity.vo.rp.dataBankClient.ClientTypicalRpVo;
import com.syni.mdd.sjb.common.datatreaure.entity.vo.rp.dataBankClient.GroupParamRpVo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;


@Mapper
public interface ClientDataCovertBasic{

    ClientDataCovertBasic INSTANCE = Mappers.getMapper(ClientDataCovertBasic.class);

    @Mappings({
            @Mapping(target = "totalUser", expression = "java(Integer.parseInt(source.getUser().getQuantity()))"),
            @Mapping(target = "totalYester", expression = "java(Integer.parseInt(source.getUser().getNewQuantity()))"),
            @Mapping(target = "totalValue", expression = "java(Double.parseDouble(source.getUser().getCustomerValue()))"),
            @Mapping(target = "potenCustomer", expression = "java(Integer.parseInt(source.getPotentialUser().getQuantity()))"),
            @Mapping(target = "potenYester", expression = "java(Integer.parseInt(source.getPotentialUser().getNewQuantity()))"),
            @Mapping(target = "potenValue", expression = "java(Double.parseDouble(source.getPotentialUser().getCustomerValue()))"),
            @Mapping(target = "vipNum", expression = "java(Integer.parseInt(source.getMember().getQuantity()))"),
            @Mapping(target = "vipYester", expression = "java(Integer.parseInt(source.getMember().getNewQuantity()))"),
            @Mapping(target = "vipValue", expression = "java(Double.parseDouble(source.getMember().getCustomerValue()))"),
            @Mapping(target = "cusNum", expression = "java(Integer.parseInt(source.getCustomer().getQuantity()))"),
            @Mapping(target = "cusYester", expression = "java(Integer.parseInt(source.getCustomer().getNewQuantity()))"),
            @Mapping(target = "cusValue", expression = "java(Double.parseDouble(source.getCustomer().getCustomerValue()))")
    })
    ClientAllGroupRpVo toConvertVo(ClientParamRpVo source);


    @Mappings({
            @Mapping(target = "userNum", expression = "java(Integer.parseInt(source.getQuantity()))"),
            @Mapping(target = "totalYester", expression = "java(Integer.parseInt(source.getNewQuantity()))"),
            @Mapping(target = "totalValue", expression = "java(Double.parseDouble(source.getCustomerValue()))"),
            @Mapping(target = "userRatio", expression = "java(Double.parseDouble(source.getRatio()))"),
            @Mapping(target = "TGI", expression = "java(Double.parseDouble(source.getTgi()))")
    })
    ClientTypicalRpVo covertGroupParam(GroupParamRpVo source);





}
